package cn.funeralobjects.upms.entity;

import cn.funeralobjects.common.annotations.CreateTime;
import cn.funeralobjects.common.annotations.UpdateTime;
import cn.funeralobjects.common.jpa.entity.BaseDelSaltJpaEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * @author FuneralObjects
 * Create date: 2020/6/3 2:37 PM
 */
@EqualsAndHashCode(callSuper = true)
@Data
@DynamicUpdate
@DynamicInsert
@Accessors(chain = true)
@Table(name = "t_user_secret")
@Entity
public class EUserSecret extends BaseDelSaltJpaEntity<Integer> {

    /**
     * 密钥值
     */
    private String secretKey;

    /**
     * 所属用户
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id", updatable = false)
    private EUser user;

    /**
     * 创建日期
     */
    @Temporal(TemporalType.TIMESTAMP)
    @CreateTime
    private Date createTime;
    /**
     * 更新日期
     */
    @Temporal(TemporalType.TIMESTAMP)
    @UpdateTime
    private Date updateTime;
}
